var http = require('http')
const urls = require('url')
var server = http.createServer()

server.on('request', function (req, res) {

    // const url = req.url

    const { pathname: url, query} = urls.parse(req.url, true)

    

    if (url === '/get') {

        var data = {
            name: 'sad',
            age: 18,
            gener: "nv"   
        }


        var scriptStr = `${query.callback}(${JSON.stringify(data)})`
        res.end(scriptStr)
    }else{
        res.end('404')
    }

})

server.listen(3000, function () {
    console.log('ok')
})